package cn.pli.bike.ui;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import com.framemodule.base.BaseActivityPresenter;
import com.framemodule.base.netstatus.NetUtils;

import java.util.List;

import cn.bingoogolapple.androidcommon.adapter.BGAOnRVItemClickListener;
import cn.pli.bike.R;
import cn.pli.bike.bean.CreditRecord;
import cn.pli.bike.bean.HttpResult;
import cn.pli.bike.bean.UserBean;
import cn.pli.bike.bean.UserInfoSetBean;
import cn.pli.bike.model.UserModel;
import cn.pli.bike.model.subscribers.ProgramSubscriber;
import cn.pli.bike.utils.AppUtils;

import static cn.pli.bike.ui.SettingDelegate.CHECK_UPDATE;
import static cn.pli.bike.ui.SettingDelegate.CLEAR_CACHE;

public class CreditRecordActivity extends BaseActivityPresenter<CreditRecordDelegate> implements View.OnClickListener {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setdata();


    }

    @Override
    protected void onResume() {
        super.onResume();
        viewDelegate.getTvScore().setText(AppUtils.getCredits() + "");
    }

    @Override
    protected void initModel() {

    }

    @Override
    protected void onNetworkConnected(NetUtils.NetType type) {

    }

    @Override
    protected void onNetworkDisConnected() {

    }

    @Override
    protected void bindEvenListener() {
        super.bindEvenListener();
        viewDelegate.setOnClickListener(this, R.id.iv_title_back);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_title_back:
                finish();
                break;
        }


    }


    /**
     * 设置数据
     */
    private void setdata() {
        UserModel.getCreditRecord(new ProgramSubscriber<HttpResult<List<CreditRecord>>>() {
            @Override
            public void onNext(HttpResult<List<CreditRecord>> listHttpResult) {
                viewDelegate.getUserInfoAdapter().setData(listHttpResult.getData());
            }
        });

    }


}
